package com.myteam.mystory.adapter;

import java.util.List;

import com.myteam.mystory.R;
import com.myteam.mystory.service.CategoriesService;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.TextView;

public class MenuLeftAdapter extends ArrayAdapter<String>{
	private Context context;
	private List<String> cateName;
	
	private TextView tv_cateName;
	private Button bt_cateCount;
	private CategoriesService categoriesService;

	public MenuLeftAdapter(Context context, int resource, List<String> objects) {
		super(context, resource, objects);
		this.context = context;
		categoriesService = new CategoriesService(context);
		cateName = categoriesService.getCateName();
	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rowView = inflater.inflate(R.layout.menuleft_adapter, parent,false);
		tv_cateName = (TextView) rowView.findViewById(R.id.menuleft_cateName);
		bt_cateCount = (Button) rowView.findViewById(R.id.menuleft_cateCount);
		tv_cateName.setText(cateName.get(position));
		return rowView;
	}

}
